<%@include file="../common/top.jsp"%>

<div id = "Catalog">

    <c:if test="${sessionScope.orderSize == 0}">
            <h3>You have no Order</h3>
    </c:if>

    <c:forEach var="order" items="${sessionScope.orders}">
        <h3>--------------------order--------------------</h3>
        <table>
            <tr>
                <th><b>OrderId</b></th>
                <th><b>OrderDate</b></th>
                <th><b>ShipToAddress</b></th>
                <th><b>ShipToFirstName</b></th>
                <th><b>ShipToLastName</b></th>
                <th><b>TotalPrice</b></th>
            </tr>
            <tr>
                <td>${order.orderId}</td>
                <td>${order.orderDate}</td>
                <td>${order.shipAddress1}</td>
                <td>${order.shipToFirstName}</td>
                <td>${order.shipToLastName}</td>
                <td>${order.totalPrice}</td>
            </tr>
            <tr>
                <th><b>Num</b></th>
                <th><b>Item ID</b></th>
                <th><b>Description</b></th>
                <th><b>Quantity</b></th>
                <th><b>List Price</b></th>
                <th><b>Total Cost</b></th>
            </tr>

        <c:forEach var="lineItem" items="${order.lineItems}">
            <tr>
                <td>${lineItem.lineNumber}</td>
                <td>
                    <a href="itemForm?itemId=${lineItem.itemId}">${lineItem.itemId}</a>
                </td>
                <td>
                        ${lineItem.item.attribute1} ${lineItem.item.attribute2}
                        ${lineItem.item.attribute3} ${lineItem.item.attribute4}
                        ${lineItem.item.attribute5} ${lineItem.item.product.name}
                </td>
                <td>${lineItem.quantity}</td>
                <td>${lineItem.unitPrice}</td>
                <td>${lineItem.total}</td>
            </tr>
        </c:forEach>
    </table>

    </c:forEach>
</div>

<%@include file="../common/bottom.jsp"%>
